package com.qiqichangting.changting.controller;

import com.changting.changtingfile.common.MessageConst;

import com.qiqichangting.changting.pojo.Result;
import com.qiqichangting.changting.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Login")
public class loginController {

    @Autowired
    private UserService userService;

    @RequestMapping("/login")
    public Result login(String username, String password){

        if (userService.login(username,password)!=null){
            return new Result(true,MessageConst.LOGIN_SUCCESS);
        }else{
            return new Result(false,MessageConst.LOGIN_FAIL);
        }
    }

}
